package com.kksoft.readcm.objects;

import android.os.AsyncTask;
import com.kksoft.readcm.b.h;
import java.util.ArrayList;
import java.util.Iterator;

public final class a
{
  private aa a=null;
  private final ArrayList<y> b;
  private boolean c;
  private boolean d;
  private boolean e;
  private boolean f;

  public a(com.kksoft.readcm.a.y paramy)
  {
    this.c = false;
    this.d = false;
    this.e = false;
    this.f = false;
    this.b = new ArrayList<y>();
    this.a = new b(2, 2);;
    this.a.a(paramy);
    int i = 0;
    do
    {
        if(i >= 2)
            return;
        b.add(new y());
        i++;
    } while(true);
  }
  
  static ArrayList<y> getList(a a1)     //old a
  {
      return a1.b;
  }

  private boolean a(int i, boolean flag)    //old a
  {
	  switch (i)
	  {
	  	default:
	  		break;
	  	case 1:
	  		c=flag;
	  		break;
	  	case 2:
	  		d=flag;
	  		break;
	  	case 3:
	  		e=flag;
	  		break;
	  	case 4:
	  		break;
	  	case 5:
	  		f=flag;
	  		break;
	  }
	  if(c && e && d && f)
          return  true;
      else
    	  return false;
  }

  public final y a(h paramh)
  {
    synchronized (this.b)
    {
      Iterator localIterator = this.b.iterator();
      do
      {
        if (!localIterator.hasNext())
        {
          return null;
        }
      }
      while (!a());
      return a(paramh);
    }
  }

  public final void a(int paramInt1, int paramInt2)
  {
    this.a.setCorePoolSize(paramInt1);
    this.a.setMaximumPoolSize(paramInt1);
    synchronized (this.b)
    {
      Iterator<y> localIterator = this.b.iterator();
      if (!localIterator.hasNext())
        return;
      ((y)localIterator.next()).a(paramInt2);
    }
  }

  public final boolean a()
  {
    return this.a.f();
  }

  public final boolean a(int paramInt)
  {
    boolean bool = a(paramInt, true);
    this.a.d();
    ad localad = new ad(this, true);
    Void[] arrayOfVoid = new Void[0];
    AsyncTask localAsyncTask = localad.execute(arrayOfVoid);
	return true;
    
  }

  public final void b()
  {
    this.a.c();
  }

  public final void b(h paramh)
  {
    this.a.a(paramh);
  }

  public final boolean b(int i)
  {
	  boolean flag;
      if(!a(i, false))
      {
          a.e();
          ad ad1 = new ad(this, false);
          Void avoid[] = new Void[0];
          android.os.AsyncTask asynctask = ad1.execute(avoid);
          flag = true;
      } else
      {
          flag = false;
      }
      return flag;
  }

  public final void c()
  {
	  a.g();
      synchronized(b)
      {
          Iterator iterator = b.iterator();
          do
          {
              if(!iterator.hasNext())
                  return;
              ((y)iterator.next()).g();
          } while(true);
      }
  }
}
